﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Business.AllocateManagement;
using Business.AllocateManagement.Dto;
using Business.Models;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.Domain.Repositories;

namespace Business.Controllers
{
    [RemoteService]
    [Area("Business")]
    [Route("api/business/allocate")]
    public class AllocateController : AbpController
    {
        private readonly IAllocateAppService _allocateAppService;

        public AllocateController(IAllocateAppService allocateAppService)
        {
            _allocateAppService = allocateAppService;
        }

        /// <summary>
        /// 新增或修改
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("create-update-allocate")]
        public  Task<AllocateDto> CreateOrUpdate(AllocateDto input)
        {
            return  _allocateAppService.CreateOrUpdate(input);
        }

        /// <summary>
        /// 获取列表
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpGet]
        [Route("get-allocate-list")]
        public  Task<PagedResultDto<AllocateDto>> GetAllocateList(AllocateInputDto input)
        {
            return _allocateAppService.GetAllocateList(input);
        }

        /// <summary>
        /// 反填
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet]
        [Route("find-allocate")]
        public  Task<AllocateDto> GetAllocateForEdit(Guid id)
        {
            return _allocateAppService.GetAllocateForEdit(id);
        }

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        [HttpDelete]
        [Route("delete-allocate")]
        public  Task DeleteAllocate(List<Guid> ids)
        {
            return _allocateAppService.DeleteAllocate(ids);
        }
    }
}
